package com.doyled.jump.framework;

import java.awt.image.BufferedImage;
import java.nio.Buffer;

import com.doyled.jump.util.BufferedImageLoader;

public class ResourceManager {
	static private ResourceManager instance;

	private BufferedImage backgroundImage;
	private BufferedImage rightButtonImage;
	private BufferedImage rightButtonHoverImage;
	private BufferedImage leftButtonImage;
	private BufferedImage leftButtonHoverImage;
	private BufferedImage startButtonImage;
	private BufferedImage startButtonHoverImage;
	private BufferedImage exitButtonImage;
	private BufferedImage exitButtonHoverImage;
	private BufferedImage infoPanelImage;
	private BufferedImage horsemenImage;
	private BufferedImage horsemenRedImage;
	private BufferedImage horsemenBlueImage;
	private BufferedImage horsemenYellowImage;
	private BufferedImage horsemenGreenImage;
	private BufferedImage diceImage;
	private BufferedImage spotImage;
	private BufferedImage menuBackGroundImage;

	public static ResourceManager getInstance() {
		if (instance == null) {
			instance = new ResourceManager();
		}
		return instance;
	}
	
	public BufferedImage getInfoPanelImage() {
		return infoPanelImage;
	}

	public BufferedImage getExitButtonImage() {
		return exitButtonImage;
	}

	public BufferedImage getExitButtonHoverImage() {
		return exitButtonHoverImage;
	}

	public BufferedImage getStartButtonImage() {
		return startButtonImage;
	}

	public BufferedImage getStartButtonHoverImage() {
		return startButtonHoverImage;
	}

	public BufferedImage getLeftButtonImage() {
		return leftButtonImage;
	}

	public BufferedImage getLeftButtonHoverImage() {
		return leftButtonHoverImage;
	}

	public BufferedImage getRightButtonImage() {
		return rightButtonImage;
	}

	public BufferedImage getRightButtonHoverImage() {
		return rightButtonHoverImage;
	}

	public BufferedImage getMenuBackGroundImage() {
		return menuBackGroundImage;
	}

	public BufferedImage getBackgroundImage() {
		return backgroundImage;
	}

	public BufferedImage getHorsemenImage() {
		return horsemenImage;
	}

	public BufferedImage getHorsemenRedImage() {
		return horsemenRedImage;
	}

	public BufferedImage getHorsemenBlueImage() {
		return horsemenBlueImage;
	}

	public BufferedImage getHorsemenYellowImage() {
		return horsemenYellowImage;
	}

	public BufferedImage getHorsemenGreenImage() {
		return horsemenGreenImage;
	}

	public BufferedImage getSpotImage() {
		return spotImage;
	}

	public BufferedImage getDiceImage() {
		return diceImage;
	}

	public ResourceManager() {
		loadResource();
	}

	private void loadResource() {
		BufferedImageLoader loader = new BufferedImageLoader();
		menuBackGroundImage = loader.loadImage("/MenuImage.png");
		rightButtonImage = loader.loadImage("/RightButton.png");
		rightButtonHoverImage = loader.loadImage("/RightButtonHover.png");
		leftButtonImage = loader.loadImage("/LeftButton.png");
		leftButtonHoverImage = loader.loadImage("/LeftButtonHover.png");
		startButtonImage = loader.loadImage("/StartItem.png");
		startButtonHoverImage = loader.loadImage("/StartItemHover.png");
		exitButtonImage = loader.loadImage("/ExitItem.png");
		exitButtonHoverImage = loader.loadImage("/ExitItemHover.png");
		backgroundImage = loader.loadImage("/Banco.png");
		infoPanelImage = loader.loadImage("/InfoPanel.png");
		horsemenImage = loader.loadImage("/Chessmen.png");
		horsemenRedImage = loader.loadImage("/ChessmenRed.png");
		horsemenBlueImage = loader.loadImage("/ChessmenBlue.png");
		horsemenYellowImage = loader.loadImage("/ChessmenYellow.png");
		horsemenGreenImage = loader.loadImage("/ChessmenGreen.png");
		diceImage = loader.loadImage("/Dice.png");
		spotImage = loader.loadImage("/Spot.png");
	}

	public void unloadResource() {
		menuBackGroundImage = null;
		rightButtonImage = rightButtonHoverImage = null;
		leftButtonImage = leftButtonHoverImage = null;
		startButtonImage = startButtonHoverImage = null;
		exitButtonImage = exitButtonHoverImage = null;
		backgroundImage = null;
		infoPanelImage = null;
		horsemenRedImage = null;
		horsemenBlueImage = null;
		horsemenYellowImage = null;
		horsemenGreenImage = null;
		spotImage = null;
	}
}
